<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var fn = (n) => {
      let res = 0;
      for (let i = 1; i <= n - 1; i++) {
        res = Math.max(res, i * (n - i), i * fn(n - i))
      }
      return res
    }
    console.log(fn(2))
  </script>
</body>

</html>